package com.demo.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Fetch;
import org.springframework.data.jpa.repository.QueryHints;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * @Description TODO 部门表
 * @author 姜皓泷
 * @changeLog 1. 创建 (2020年1月9日 下午4:57:32 [姜皓泷])
 * 
 */
@Entity
@Table(name = "department")
//@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class Department implements Serializable {

	// TODO
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id; // 主键
	@Column(name = "department")
	private String department; // 部门
	@Column(name = "parentId")
	private Integer parentId; // 上级部门编号
	@Column(name = "creator")
	private Integer creator; // 创建人编号

	@Temporal(TemporalType.DATE) // 列如果是date类型，这里就必须要指定DATE；列如果是时间戳类型，这里就必须要指定TIMESTAMP类型
	@JsonFormat(pattern = "yyyy年MM月dd HH:mm:ss", timezone = "GMT+8") // 前端拿到的时间格式化
	private Date updateTime; // 修改时间

	@Temporal(TemporalType.DATE) // 列如果是date类型，这里就必须要指定DATE；列如果是时间戳类型，这里就必须要指定TIMESTAMP类型
	@JsonFormat(pattern = "yyyy年MM月dd HH:mm:ss", timezone = "GMT+8") // 前端拿到的时间格式化
	private Date createTime; // 创建时间

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the department
	 */
	public String getDepartment() {
		return department;
	}

	/**
	 * @param department the department to set
	 */
	public void setDepartment(String department) {
		this.department = department;
	}

	/**
	 * @return the parentId
	 */
	public Integer getParentId() {
		return parentId;
	}

	/**
	 * @param parentId the parentId to set
	 */
	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	/**
	 * @return the creator
	 */
	public Integer getCreator() {
		return creator;
	}

	/**
	 * @param creator the creator to set
	 */
	public void setCreator(Integer creator) {
		this.creator = creator;
	}

	/**
	 * @return the updateTime
	 */
	public Date getUpdateTime() {
		return updateTime;
	}

	/**
	 * @param updateTime the updateTime to set
	 */
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	/**
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * @param createTime the createTime to set
	 */
	public void setCreateTime(Date creatTime) {
		this.createTime = creatTime;
	}
	
	public Department() {
	}
	
	public Department(Integer id,String department) {
		this.id=id;
		this.department = department;
	}
	
	public Department(String department, Integer parentId, Integer creator, Date updateTime, Date createTime) {
		this.department = department;
		this.parentId = parentId;
		this.creator = creator;
		this.updateTime = updateTime;
		this.createTime = createTime;
	}
}
